package org.kuaishou.util;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class ConfirmUI extends JFrame {

    private JPanel contentPane;
    private boolean aBoolean = false;
    JLabel lblNewLabel;

    /**
     * Launch the application.
     */
//    public static void main(String[] args) {
//        EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                try {
//                    ConfirmUI frame = new ConfirmUI();
//                } catch (Exception e) {
//                    e.printStackTrace();
//                }
//            }
//        });
//    }

    /**
     * Create the frame.
     */
    public ConfirmUI() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 450, 300);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        contentPane.setLayout(null);
        //
        setVisible(true);
        setTitle("确认执行");
        setLocationRelativeTo(null);// 显示屏幕中间,写在设置窗体大小的后面
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //
        lblNewLabel = new JLabel("New label");
        lblNewLabel.setBounds(27, 22, 375, 27);
        contentPane.add(lblNewLabel);

        {
            JButton btnNewButton = new JButton("继 续");
            btnNewButton.setBounds(103, 117, 93, 23);
            contentPane.add(btnNewButton);
            btnNewButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    aBoolean = true;
                    lblNewLabel.setText("继 续");
                }
            });
        }

        {
            JButton btnNewButton_1 = new JButton("退 出");
            btnNewButton_1.setBounds(284, 117, 93, 23);
            contentPane.add(btnNewButton_1);
            btnNewButton_1.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    aBoolean = false;
                    lblNewLabel.setText("退 出");
                }
            });
        }


    }

    //get set
    public boolean getaBoolean() {
        return aBoolean;
    }

    public void setLable(String lable) {
        lblNewLabel.setText(lable);
    }

}
